package com.xiaoxu.intranetweb.mybatisplusSzappdb.controller.systemSetting;

import com.alibaba.fastjson.JSONObject;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.business.systemSetting.SystemSettingBu;
import com.xiaoxu.intranetweb.util.SzResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/systemSetting")
public class SystemSettingController {
    @Autowired
    private SystemSettingBu systemSettingBu;

    @GetMapping("/getSystemSetting")
    public SzResult getSystemSetting(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
//        if (!userInfoDao.getUserPermissionWeb(StpUtil.getLoginIdByToken(token).toString()).containsKey("icCardAdvanced_icCardAdvanced")) {
//            return SzResult.error("您没有操作IC卡高级信息的权限");
//        }
        return systemSettingBu.getSystemSetting(plantId);
    }

    @PostMapping("/updateSystemSetting")
    public SzResult updateSystemSetting(HttpServletRequest request, @RequestBody JSONObject jsonObject) throws Exception {

//        if (!userInfoDao.getUserPermissionWeb(StpUtil.getLoginIdByToken(token).toString()).containsKey("icCardAdvanced_icCardAdvanced")) {
//            return SzResult.error("您没有操作IC卡高级信息的权限");
//        }
        String CalcComplByMonths = jsonObject.getString("CalcComplByMonths");
        String CalcComplByDayStart = jsonObject.getString("CalcComplByDayStart");
        String PlanRemainLimit = jsonObject.getString("PlanRemainLimit");
        String PlanRemainWholePct = jsonObject.getString("PlanRemainWholePct");
        String EnablePdtPlan = jsonObject.getString("EnablePdtPlan");
        String PdtPlanMode = jsonObject.getString("PdtPlanMode");
        String PdtPlanType = jsonObject.getString("PdtPlanType");
        String PdtPlanDefTimeBegin = jsonObject.getString("PdtPlanDefTimeBegin");
        String PdtPlanDefTimeBeginFixed = jsonObject.getString("PdtPlanDefTimeBeginFixed");
        String PdtPlanCalcBasis = jsonObject.getString("PdtPlanCalcBasis");
        String CapEnterGateMust = jsonObject.getString("CapEnterGateMust");
        String TruckApprvToEnter = jsonObject.getString("TruckApprvToEnter");
        String TempTruckDefRefTare = jsonObject.getString("TempTruckDefRefTare");
        String TempTruckDefRefNet = jsonObject.getString("TempTruckDefRefNet");
        String TempTruckDefRefGross = jsonObject.getString("TempTruckDefRefGross");
        String TempTruckDefAgainMinTm = jsonObject.getString("TempTruckDefAgainMinTm");
        String TempTruckDefMustQueue = jsonObject.getString("TempTruckDefMustQueue");
        String TempTruckDefIdentyQueue = jsonObject.getString("TempTruckDefIdentyQueue");
        String TempTruckDefIdentyLoad = jsonObject.getString("TempTruckDefIdentyLoad");
        String TempTruckDefApprved = jsonObject.getString("TempTruckDefApprved");
        String TempTruckDefLength = jsonObject.getString("TempTruckDefLength");
        String QUQueueToIdentyTmLimit = jsonObject.getString("QUQueueToIdentyTmLimit");
        String QUCallInToPoundInTmLimitAsh = jsonObject.getString("QUCallInToPoundInTmLimitAsh");
        String QUCallInToPoundInTmLimitGypsum = jsonObject.getString("QUCallInToPoundInTmLimitGypsum");
        String QUCallInToPoundInTmLimitCinder = jsonObject.getString("QUCallInToPoundInTmLimitCinder");
        String QUCallInToPoundInTmLimit = jsonObject.getString("QUCallInToPoundInTmLimit");
        String QUCallInOverdueHandleMode = jsonObject.getString("QUCallInOverdueHandleMode");
        String QuMaxIdentyTmEarlierChkInTm = jsonObject.getString("QuMaxIdentyTmEarlierChkInTm");
        String AvoidCallInTimeOutBegin = jsonObject.getString("AvoidCallInTimeOutBegin");
        String AvoidCallInTimeOutEnd = jsonObject.getString("AvoidCallInTimeOutEnd");
        String GuardProhibitLeaveManu = jsonObject.getString("GuardProhibitLeaveManu");
        String GuardProhibitCardLeave = jsonObject.getString("GuardProhibitCardLeave");
        String GuardMustReadCardLeave = jsonObject.getString("GuardMustReadCardLeave");
        String GuardMustReadCardLeaveManAffirm = jsonObject.getString("GuardMustReadCardLeaveManAffirm");
        String FellowSiteFIFO = jsonObject.getString("FellowSiteFIFO");
        String StrobeProhibitChgLoadSite = jsonObject.getString("StrobeProhibitChgLoadSite");
        String QueueMaxTrucksCtrlMode = jsonObject.getString("QueueMaxTrucksCtrlMode");
        String QueueCoMaxTrucks = jsonObject.getString("QueueCoMaxTrucks");
        String QueuePdtMaxTrucks = jsonObject.getString("QueuePdtMaxTrucks");
        String dbtypewspic = jsonObject.getString("dbtypewspic");
        String ExWsPicDbDriver = jsonObject.getString("ExWsPicDbDriver");
        String ExWsPicDbIp = jsonObject.getString("ExWsPicDbIp");
        String ExWsPicDbIpLocalSvr = jsonObject.getString("ExWsPicDbIpLocalSvr");
        String ExWsPicDbIpLocalStrobe = jsonObject.getString("ExWsPicDbIpLocalStrobe");
        String ExWsPicDbIpLocalGuard = jsonObject.getString("ExWsPicDbIpLocalGuard");
        String ExWsPicDbIpBackup = jsonObject.getString("ExWsPicDbIpBackup");
        String ExWsPicDbPort = jsonObject.getString("ExWsPicDbPort");
        String ExWsPicDbSid = jsonObject.getString("ExWsPicDbSid");
        String ExWsPicDbUserName = jsonObject.getString("ExWsPicDbUserName");
        String ExWsPicDbPwd = jsonObject.getString("ExWsPicDbPwd");
        String ExWsPicDbTable = jsonObject.getString("ExWsPicDbTable");
        String PrevTheftDevEn = jsonObject.getString("PrevTheftDevEn");
        String PrevTheftDevType = jsonObject.getString("PrevTheftDevType");
        String PrevTheftDevConnMode = jsonObject.getString("PrevTheftDevConnMode");
        String PrevTheftDevConnModeSvr = jsonObject.getString("PrevTheftDevConnModeSvr");
        String PrevTheftDevConnModeStrobeGuard = jsonObject.getString("PrevTheftDevConnModeStrobeGuard");
        String PrevTheftDevCount = jsonObject.getString("PrevTheftDevCount");
        String PrevTheftDevName = jsonObject.getString("PrevTheftDevName");
        String PrevTheftDevName2 = jsonObject.getString("PrevTheftDevName2");
        String PrevTheftDevIP = jsonObject.getString("PrevTheftDevIP");
        String PrevTheftDevIP2 = jsonObject.getString("PrevTheftDevIP2");
        String PrevTheftDevIPLan = jsonObject.getString("PrevTheftDevIPLan");
        String PrevTheftDevIPLan2 = jsonObject.getString("PrevTheftDevIPLan2");
        String PrevTheftDevPort = jsonObject.getString("PrevTheftDevPort");
        String PrevTheftDevPort2 = jsonObject.getString("PrevTheftDevPort2");
        String PrevTheftDevPortLan = jsonObject.getString("PrevTheftDevPortLan");
        String PrevTheftDevPortLan2 = jsonObject.getString("PrevTheftDevPortLan2");
        String PrevTheftDevUsrName = jsonObject.getString("PrevTheftDevUsrName");
        String PrevTheftDevUsrName2 = jsonObject.getString("PrevTheftDevUsrName2");
        String PrevTheftDevUsrPwd = jsonObject.getString("PrevTheftDevUsrPwd");
        String PrevTheftDevUsrPwd2 = jsonObject.getString("PrevTheftDevUsrPwd2");
        String RemainAlarm = jsonObject.getString("RemainAlarm");
        String RemainLimit = jsonObject.getString("RemainLimit");
        String RemainAlarmPowder = jsonObject.getString("RemainAlarmPowder");
        String RemainLimitPowder = jsonObject.getString("RemainLimitPowder");
        String RemainAlarmGypsum = jsonObject.getString("RemainAlarmGypsum");
        String RemainLimitGypsum = jsonObject.getString("RemainLimitGypsum");
        String RemainAlarmCinder = jsonObject.getString("RemainAlarmCinder");
        String RemainLimitCinder = jsonObject.getString("RemainLimitCinder");
        String CreditLineFunc = jsonObject.getString("CreditLineFunc");
        String CreditLineEn = jsonObject.getString("CreditLineEn");
        String CreditLineLimit = jsonObject.getString("CreditLineLimit");
        String CreditLineStartMode = jsonObject.getString("CreditLineStartMode");
        String CreditLineStartPtWeekDay = jsonObject.getString("CreditLineStartPtWeekDay");
        String PrePriceFunc = jsonObject.getString("PrePriceFunc");
        String PrePriceEn = jsonObject.getString("PrePriceEn");
        String PrePriceDefAlarmPt = jsonObject.getString("PrePriceDefAlarmPt");
        String PrePriceDefLimitPt = jsonObject.getString("PrePriceDefLimitPt");
        String GuardIP = jsonObject.getString("GuardIP");
        String GuardPort = jsonObject.getString("GuardPort");
        String GuardName = jsonObject.getString("GuardName");
        String StrobeIP1 = jsonObject.getString("StrobeIP1");
        String StrobeIP2 = jsonObject.getString("StrobeIP2");
        String StrobeIP3 = jsonObject.getString("StrobeIP3");
        String StrobeIP4 = jsonObject.getString("StrobeIP4");
        String StrobeIP5 = jsonObject.getString("StrobeIP5");
        String StrobePort1 = jsonObject.getString("StrobePort1");
        String StrobePort2 = jsonObject.getString("StrobePort2");
        String StrobePort3 = jsonObject.getString("StrobePort3");
        String StrobePort4 = jsonObject.getString("StrobePort4");
        String StrobePort5 = jsonObject.getString("StrobePort5");
        String StrobeHostName1 = jsonObject.getString("StrobeHostName1");
        String StrobeHostName2 = jsonObject.getString("StrobeHostName2");
        String StrobeHostName3 = jsonObject.getString("StrobeHostName3");
        String StrobeHostName4 = jsonObject.getString("StrobeHostName4");
        String StrobeHostName5 = jsonObject.getString("StrobeHostName5");
        String TruckTareErrorEn = jsonObject.getString("TruckTareErrorEn");
        String TruckTareErrorMax = jsonObject.getString("TruckTareErrorMax");
        String TruckTareErrorMaxPowder = jsonObject.getString("TruckTareErrorMaxPowder");
        String TruckTareErrorType = jsonObject.getString("TruckTareErrorType");
        String TruckTareErrorHandleMode = jsonObject.getString("TruckTareErrorHandleMode");
        String CoalBatchDigits = jsonObject.getString("CoalBatchDigits");
        String CoalBatchFormatDate = jsonObject.getString("CoalBatchFormatDate");
        String CoalBatchFormatNo = jsonObject.getString("CoalBatchFormatNo");
        String CoalBoatShipEn = jsonObject.getString("CoalBoatShipEn");
        String TruckCoalEn = jsonObject.getString("TruckCoalEn");
        String TruckCoalNetErrorEn = jsonObject.getString("TruckCoalNetErrorEn");
        String TruckCoalNetErrorMax = jsonObject.getString("TruckCoalNetErrorMax");
        String TruckCoalNetTakeMin = jsonObject.getString("TruckCoalNetTakeMin");
        String TruckCoalBillGrossTopLimit = jsonObject.getString("TruckCoalBillGrossTopLimit");
        String TruckCoalBillGrossLowLimit = jsonObject.getString("TruckCoalBillGrossLowLimit");
        String TruckCoalBillTareTopLimit = jsonObject.getString("TruckCoalBillTareTopLimit");
        String TruckCoalBillTareLowLimit = jsonObject.getString("TruckCoalBillTareLowLimit");
        String TruckCoalBanSameShipMulSn = jsonObject.getString("TruckCoalBanSameShipMulSn");
        String TruckCoalBanMulShipSameSn = jsonObject.getString("TruckCoalBanMulShipSameSn");
        String TruckCoalBanMulBoatSameSn = jsonObject.getString("TruckCoalBanMulBoatSameSn");
        String TruckCoalMustSampToLeave = jsonObject.getString("TruckCoalMustSampToLeave");
        String TrainCoalEn = jsonObject.getString("TrainCoalEn");
        String TrainCoalBillNetTopLimit = jsonObject.getString("TrainCoalBillNetTopLimit");
        String TrainCoalBillNetLowLimit = jsonObject.getString("TrainCoalBillNetLowLimit");
        String TrainCoalBillTareTopLimit = jsonObject.getString("TrainCoalBillTareTopLimit");
        String TrainCoalBillTareLowLimit = jsonObject.getString("TrainCoalBillTareLowLimit");
        String TrainCoalBanMulShipSameSn = jsonObject.getString("TrainCoalBanMulShipSameSn");
        String TrainCoalBanMulTrainSameSn = jsonObject.getString("TrainCoalBanMulTrainSameSn");
        String TruckDispatchEn = jsonObject.getString("TruckDispatchEn");
        String TruckDispatchPdtEn = jsonObject.getString("TruckDispatchPdtEn");
        String TruckDispatchCoEn = jsonObject.getString("TruckDispatchCoEn");
        String TruckDispatchAutoEn = jsonObject.getString("TruckDispatchAutoEn");
        String TruckDispatchAutoCancelEn = jsonObject.getString("TruckDispatchAutoCancelEn");
        String TruckDispatchAutoTimeOutEn = jsonObject.getString("TruckDispatchAutoTimeOutEn");
        String TruckDispatchAutoTimeOutValue = jsonObject.getString("TruckDispatchAutoTimeOutValue");
        String PoundNoPdtLimitTruckNo = jsonObject.getString("PoundNoPdtLimitTruckNo");
        String LockLoadSiteEn = jsonObject.getString("LockLoadSiteEn");
        String HideSpeSplyCoEn = jsonObject.getString("HideSpeSplyCoEn");
        String DiscountEn = jsonObject.getString("DiscountEn");
        String CashDisCount0 = jsonObject.getString("CashDisCount0");
        String CashDisCount1 = jsonObject.getString("CashDisCount1");
        String CashDisCount2 = jsonObject.getString("CashDisCount2");
        String CashDisCount3 = jsonObject.getString("CashDisCount3");
        String CashDisCount4 = jsonObject.getString("CashDisCount4");
        String CashDisCount5 = jsonObject.getString("CashDisCount5");
        String CashDisCount6 = jsonObject.getString("CashDisCount6");
        String PrepayDisCount0 = jsonObject.getString("PrepayDisCount0");
        String PrepayDisCount1 = jsonObject.getString("PrepayDisCount1");
        String PrepayDisCount2 = jsonObject.getString("PrepayDisCount2");
        String PrepayDisCount3 = jsonObject.getString("PrepayDisCount3");
        String PrepayDisCount4 = jsonObject.getString("PrepayDisCount4");
        String PrepayDisCount5 = jsonObject.getString("PrepayDisCount5");
        String PrepayDisCount6 = jsonObject.getString("PrepayDisCount6");
        String DieselCashDisCount0 = jsonObject.getString("DieselCashDisCount0");
        String DieselCashDisCount1 = jsonObject.getString("DieselCashDisCount1");
        String DieselCashDisCount2 = jsonObject.getString("DieselCashDisCount2");
        String DieselCashDisCount3 = jsonObject.getString("DieselCashDisCount3");
        String DieselCashDisCount4 = jsonObject.getString("DieselCashDisCount4");
        String DieselCashDisCount5 = jsonObject.getString("DieselCashDisCount5");
        String DieselCashDisCount6 = jsonObject.getString("DieselCashDisCount6");
        String DieselPrepayDisCount0 = jsonObject.getString("DieselPrepayDisCount0");
        String DieselPrepayDisCount1 = jsonObject.getString("DieselPrepayDisCount1");
        String DieselPrepayDisCount2 = jsonObject.getString("DieselPrepayDisCount2");
        String DieselPrepayDisCount3 = jsonObject.getString("DieselPrepayDisCount3");
        String DieselPrepayDisCount4 = jsonObject.getString("DieselPrepayDisCount4");
        String DieselPrepayDisCount5 = jsonObject.getString("DieselPrepayDisCount5");
        String DieselPrepayDisCount6 = jsonObject.getString("DieselPrepayDisCount6");
        String CapEnterSameTruckIntv = jsonObject.getString("CapEnterSameTruckIntv");
        String CapEnterToPoundTimeLimit = jsonObject.getString("CapEnterToPoundTimeLimit");
        String CapEnterCmpProvince = jsonObject.getString("CapEnterCmpProvince");
        String CapEnterPlateErrCount = jsonObject.getString("CapEnterPlateErrCount");
        String CapEnterPlateReadyTimes = jsonObject.getString("CapEnterPlateReadyTimes");
        String CapOutSameTruckIntv = jsonObject.getString("CapOutSameTruckIntv");
        String CapOutFromPoundTimeLimit = jsonObject.getString("CapOutFromPoundTimeLimit");
        String CapOutPlateReadyTimes = jsonObject.getString("CapOutPlateReadyTimes");
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return systemSettingBu.updateSysTemSetting(CalcComplByMonths, CalcComplByDayStart, PlanRemainLimit, PlanRemainWholePct, EnablePdtPlan, PdtPlanMode, PdtPlanType, PdtPlanDefTimeBegin, PdtPlanDefTimeBeginFixed, PdtPlanCalcBasis, CapEnterGateMust, TruckApprvToEnter, TempTruckDefRefTare, TempTruckDefRefNet, TempTruckDefRefGross, TempTruckDefAgainMinTm, TempTruckDefMustQueue, TempTruckDefIdentyQueue, TempTruckDefIdentyLoad, TempTruckDefApprved, TempTruckDefLength, QUQueueToIdentyTmLimit, QUCallInToPoundInTmLimitAsh, QUCallInToPoundInTmLimitGypsum, QUCallInToPoundInTmLimitCinder, QUCallInToPoundInTmLimit, QUCallInOverdueHandleMode, QuMaxIdentyTmEarlierChkInTm, AvoidCallInTimeOutBegin, AvoidCallInTimeOutEnd, GuardProhibitLeaveManu, GuardProhibitCardLeave, GuardMustReadCardLeave, GuardMustReadCardLeaveManAffirm, FellowSiteFIFO, StrobeProhibitChgLoadSite, QueueMaxTrucksCtrlMode, QueueCoMaxTrucks, QueuePdtMaxTrucks, dbtypewspic, ExWsPicDbDriver, ExWsPicDbIp, ExWsPicDbIpLocalSvr, ExWsPicDbIpLocalStrobe, ExWsPicDbIpLocalGuard, ExWsPicDbIpBackup, ExWsPicDbPort, ExWsPicDbSid, ExWsPicDbUserName, ExWsPicDbPwd, ExWsPicDbTable, PrevTheftDevEn, PrevTheftDevType, PrevTheftDevConnMode, PrevTheftDevConnModeSvr, PrevTheftDevConnModeStrobeGuard, PrevTheftDevCount, PrevTheftDevName, PrevTheftDevName2, PrevTheftDevIP, PrevTheftDevIP2, PrevTheftDevIPLan, PrevTheftDevIPLan2, PrevTheftDevPort, PrevTheftDevPort2, PrevTheftDevPortLan, PrevTheftDevPortLan2, PrevTheftDevUsrName, PrevTheftDevUsrName2, PrevTheftDevUsrPwd, PrevTheftDevUsrPwd2, RemainAlarm, RemainLimit, RemainAlarmPowder, RemainLimitPowder, RemainAlarmGypsum, RemainLimitGypsum, RemainAlarmCinder, RemainLimitCinder, CreditLineFunc, CreditLineEn, CreditLineLimit, CreditLineStartMode, CreditLineStartPtWeekDay, PrePriceFunc, PrePriceEn, PrePriceDefAlarmPt, PrePriceDefLimitPt, GuardIP, GuardPort, GuardName, StrobeIP1, StrobeIP2, StrobeIP3, StrobeIP4, StrobeIP5, StrobePort1, StrobePort2, StrobePort3, StrobePort4, StrobePort5, StrobeHostName1, StrobeHostName2, StrobeHostName3, StrobeHostName4, StrobeHostName5, TruckTareErrorEn, TruckTareErrorMax, TruckTareErrorMaxPowder, TruckTareErrorType, TruckTareErrorHandleMode, CoalBatchDigits, CoalBatchFormatDate, CoalBatchFormatNo, CoalBoatShipEn, TruckCoalEn, TruckCoalNetErrorEn, TruckCoalNetErrorMax, TruckCoalNetTakeMin, TruckCoalBillGrossTopLimit, TruckCoalBillGrossLowLimit, TruckCoalBillTareTopLimit, TruckCoalBillTareLowLimit, TruckCoalBanSameShipMulSn, TruckCoalBanMulShipSameSn, TruckCoalBanMulBoatSameSn, TruckCoalMustSampToLeave, TrainCoalEn, TrainCoalBillNetTopLimit, TrainCoalBillNetLowLimit, TrainCoalBillTareTopLimit, TrainCoalBillTareLowLimit, TrainCoalBanMulShipSameSn, TrainCoalBanMulTrainSameSn, TruckDispatchEn, TruckDispatchPdtEn, TruckDispatchCoEn, TruckDispatchAutoEn, TruckDispatchAutoCancelEn, TruckDispatchAutoTimeOutEn, TruckDispatchAutoTimeOutValue, PoundNoPdtLimitTruckNo, LockLoadSiteEn, HideSpeSplyCoEn, DiscountEn, CashDisCount0, CashDisCount1, CashDisCount2, CashDisCount3, CashDisCount4, CashDisCount5, CashDisCount6, PrepayDisCount0, PrepayDisCount1, PrepayDisCount2, PrepayDisCount3, PrepayDisCount4, PrepayDisCount5, PrepayDisCount6, DieselCashDisCount0, DieselCashDisCount1, DieselCashDisCount2, DieselCashDisCount3, DieselCashDisCount4, DieselCashDisCount5, DieselCashDisCount6, DieselPrepayDisCount0, DieselPrepayDisCount1, DieselPrepayDisCount2, DieselPrepayDisCount3, DieselPrepayDisCount4, DieselPrepayDisCount5, DieselPrepayDisCount6, CapEnterSameTruckIntv, CapEnterToPoundTimeLimit, CapEnterCmpProvince, CapEnterPlateErrCount, CapEnterPlateReadyTimes, CapOutSameTruckIntv, CapOutFromPoundTimeLimit, CapOutPlateReadyTimes, token,plantId
        );
    }

}
